import psycopg

with psycopg.connect("dbname=examdb user=examdb") as conn:
    with conn.cursor() as cur:
        cur.execute('''
        DROP TABLE IF EXISTS test_tbl1;
        CREATE TABLE IF NOT EXISTS test_tbl1 (
            sn   INTEGER,   --序号
            name TEXT       --姓名
        );
        ''')
